#include <iostream>
#include <cstdio>
#define MAX 100
typedef long long ll;
ll a[MAX];
ll cnt[MAX];
using namespace std;
int main() {
    a[0]=1;
    a[1]=2;
    for (int i=2; i<100; i++) a[i]=a[i-1]+a[i-2];
    cnt[0]=1;
    for (int i=1; i<100; i++) cnt[i]=a[i] + cnt[i-1];
    int n;
    ll q,result;
    scanf("%d",&n);
    for (int i=0; i<n; i++) {
        scanf("%lld",&q);
        result=0;
        while(cnt[result]<=q) result++;
        printf("%lld\n",result);
    }
    return 0;
}
